var api = require('/config/api.js');
var common = require('/utils/common.js');
var imgurl = 'http://yanfademo.qd-weimob.com/olehui/';

App({
  onLaunch: function (options) {
    wx.login({
      success: function (res) {
        wx.request({
          url: api.LoginOpenid,
          data: {
            code: res.code
          },
          method: 'POST',
          header: {
            'content-type': 'application/x-www-form-urlencoded'
          },
          success: function (res) {
            if (res.data.type == 'success') {
              wx.setStorageSync("sessionKeyToken", res.data.data.sessionKeyToken);
              wx.setStorageSync("token", res.data.data.token);
              wx.setStorageSync("memberId", res.data.data.memberId);
            } else {
              wx.setStorageSync("sessionKeyToken", "");
              wx.setStorageSync("token", "");
              wx.setStorageSync("memberId", "");
            }
          }
        });
      }
    });
  },
  globalData: {
    token: '',
    imgurl: imgurl,
    phoneNumber:"18668966194",
    phoneNumberStr: "186-6896-6194",
    showLodingTime: 400,
    isyezhu:false
  }
})